package org.blog.service;

import java.util.List;

import org.blog.dao.MonitorMapper;
import org.blog.helper.Constants;
import org.blog.model.MonitorModel;
import org.blog.model.ext.MonitorModelExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MonitorServiceImpl implements MonitorService {

	@Autowired
	private MonitorMapper monitorMapper;

	// /** 每页显示数据为50条 */
	// private int Constants.pages = 50;

	@Override
	public List<MonitorModelExt> listAll(int page) {

		return monitorMapper.listAll((page - 1) * Constants.pages, Constants.pages);
	}

	public int countAll() {
		return monitorMapper.countAll();
	}

	@Override
	public List<MonitorModelExt> listJid(String jid, int page) {
		return monitorMapper.listJid(jid, (page - 1) * Constants.pages, Constants.pages);
	}

	public int countJid(String jid) {
		return monitorMapper.countJid(jid);
	}

	public MonitorModelExt get(Long id) {
		return monitorMapper.get(id);
	}

	@Override
	public void deleteBelow(long createtime) {
		monitorMapper.deleteBelow(createtime);
	}

	@Override
	public void insert(MonitorModel model) {
		monitorMapper.insert(model);
	}
}
